home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 46 / Amiga Format CD46 (1999-10-20)(Future Publishing)(GB)[!][issue 1999-12].iso / -in_the_mag- / reader_requests / scilab / demos / wheel2 / wheel.dem < prev    next >
Text File  |  1999-09-16  |  1KB  |  51 lines

  1. path="SCI/demos/wheel2";
  2. mode(-1);
  3. getf(path+'/show.sci','c');
  4. xbasc();
  5. flag1=x_choose(['Reading a precomputed trajectory';
  6.  'Simulation with ode (needs f77 and link. may fail, see help link)'],...
  7. 'Simulation or Visualisation ? (click below)');
  8.  
  9. select flag1,
  10.  case 2 then host("cd $"+path+"; make ");
  11. mode(0);
  12.     if ~c_link('wheel') then link('/tmp/wheel.o ','wheel');end
  13.     if ~c_link('wheelg') then link('/tmp/wheelg.o ','wheelg');end
  14.     wheelg=wheelgf;
  15.     tmin=0.0;tmax=15;nn=300;
  16.     times=(0:(nn-1));
  17.     times=tmax*times/(nn-1) +tmin*((nn-1)*ones(times)-times);
  18.     //               INITIAL CONDITIONS
  19.     x0=[0;                     //theta
  20.           %pi/2+0.1;       //phi
  21.             0;              //psi
  22.             5.0;            //Dtheta
  23.             0.0;              //Dphi
  24.            4.0;             //Dpsi
  25.             0;               //x
  26.             0];               //y
  27.  
  28.     //               SIMULATION
  29.     x=ode(x0,tmin,times,'wheel');
  30.     xselect();
  31.     xbasc();
  32.     show(x)
  33.     ystr=[ 'phi';'theta';'psi';'Dpsi';'Dtheta';'Dpsi';'x';'y'];
  34.         flag=2;
  35.     while flag=2, [n1,n2]=size(x);
  36.           flag=x_choose(['Stop';'Go on'],'Choose');
  37.                 if flag=2,x0=evstr(x_mdialog(['Initial conditions'],...
  38.                       ystr,string(x(:,n2))));
  39.           x=ode(x0,tmin,times,'wheel');
  40.           xbasc();show(x);
  41.         end;
  42.     end
  43.  case 1 then // A precomputed value for 
  44.          //x0=[0;%pi/2+0.1;0;5.0;0.0;4.0;0;0];
  45.     x=read(path+'/x.wrt',8,301);
  46.     wheelg=wheelgs;
  47.     show(x);
  48. end
  49.  
  50.  
  51.